package org.hairball.analysis;

import java.lang.reflect.Method;

/**
 * Created by IntelliJ IDEA.
 * User: samnewman
 * Date: Jun 21, 2007
 * Time: 5:38:43 PM
 * To change this template use File | Settings | File Templates.
 */
public class NumberOfMethodsCounter {
    public NumberOfMethodsCounter() {

    }

    public int getNumberOfPublicMethods(Class clazz) {
        Method[] methods = clazz.getMethods();
        int count = 0;
        for (Method method : methods) {
            if (method.getDeclaringClass().equals(clazz)) {
                count++;
            }
        }
        return count;
    }
}
